//
//  DepoistInfoAddressCell.swift
//  d11
//
//  Created by peale on 2018/10/21.
//  Copyright © 2018年 Tech_001. All rights reserved.
//

import UIKit

class DepoistInfoAddressCell: UITableViewCell {
    var bgImgView : UIImageView?
    var iconImgView : UIImageView?
    var titleLabel : UILabel?
    var textField : UILabel?
    var hintLabel : UILabel?
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.setUpUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
    }
    
    func setUpUI() -> Void {
        self.backgroundColor  = UIColor.clear
        self.selectionStyle = UITableViewCell.SelectionStyle.none
        // self.contentView!.backgroundColor  = UIColor.clear
        self.bgImgView = UIImageView.init()
        self.bgImgView?.image = imageNamed("icon_my_cell_bottom")?.resizableImage(withCapInsets: UIEdgeInsets(top: 5, left: 30, bottom: 5, right: 30),resizingMode: .stretch) //左右15像素的部分不变，中间部分来拉伸
        self.contentView.addSubview(bgImgView!)
        self.bgImgView?.snp.makeConstraints{(make) in
            make.width.equalToSuperview()
          //  make.height.equalTo(104.5)
            make.height.equalTo(80)
            make.centerX.equalTo(self.contentView)
        };
        
        self.iconImgView = UIImageView.init()
        self.iconImgView?.image = imageNamed("icon_withdraw_hint2")
        self.bgImgView?.addSubview(self.iconImgView!)
        self.iconImgView?.snp.makeConstraints{(make) in
            make.left.equalToSuperview().offset(12)
            make.width.equalTo(20)
            make.height.equalTo(20)
           // make.top.equalToSuperview().offset(17.5)
            make.centerY.equalToSuperview()
        }
        self.titleLabel = UILabel.init()
        self.titleLabel?.text = "温馨提示"
        self.titleLabel?.textColor = HexRGBAlpha(0x333333, 1)
        self.titleLabel?.font = UIFont.systemFont(ofSize: 15)
        self.titleLabel?.textAlignment = NSTextAlignment.left
        self.bgImgView?.addSubview(self.titleLabel!)
        
        self.titleLabel?.snp.makeConstraints{(make) in
            make.left.equalTo((self.iconImgView?.snp.right)!).offset(12)
            make.width.equalTo(70)
            make.height.equalTo(50)
          //  make.top.equalToSuperview().offset(5)
            make.centerY.equalToSuperview()
        }
        
        self.textField = UILabel.init()
        self.textField?.textColor =  HexRGBAlpha(0x8E8F90, 1)
        if kScreenW <= 320 {
            self.textField?.font = UIFont.systemFont(ofSize: 12)
        }else{
           self.textField?.font = UIFont.systemFont(ofSize: 14)
        }
        
        self.textField?.textAlignment = NSTextAlignment.left
        self.textField?.isEnabled = false
         self.textField?.numberOfLines = 4
        self.bgImgView?.addSubview(self.textField!)
        //     self.textField?.addTarget(self, action: #selector(self.actionToChanged(_:)), for: UIControlEvents.editingChanged)
        self.textField?.snp.makeConstraints{(make) in
            make.left.equalTo((self.titleLabel?.snp.right)!).offset(12)
            make.right.equalToSuperview().offset(-15)
              make.top.equalToSuperview().offset(5)
            make.height.equalTo(60)
        }
        self.hintLabel = UILabel.init()
        self.hintLabel?.text = "请您在十分钟内汇款完毕，卡号不定时更换，入款前请仔细检查以免影响到您的正常入款，谢谢。"
        self.hintLabel?.textColor = HexRGBAlpha(0x333333, 1)
        self.hintLabel?.font = UIFont.systemFont(ofSize: 10)
        self.hintLabel?.numberOfLines = 2
        self.hintLabel?.textAlignment = NSTextAlignment.left
         self.hintLabel?.isHidden = true
        self.hintLabel?.textColor =  HexRGBAlpha(0x8E8F90, 1)
        self.bgImgView?.addSubview(self.hintLabel!)
        
        self.hintLabel?.snp.makeConstraints{(make) in
            make.bottom.equalToSuperview().offset(-10)
            make.right.equalToSuperview().offset(-40)
            make.height.equalTo(35)
            make.left.equalTo((self.iconImgView?.snp.right)!).offset(12)
        }
    }
    
    func setData(inputText:String)->Void{
        self.bgImgView?.image = imageNamed("icon_depoist_cell_bottom")?.resizableImage(withCapInsets: UIEdgeInsets(top: 5, left: 30, bottom: 5, right: 30),resizingMode: .stretch) //左右15像素的部分不变，中间部分来拉伸
        self.textField?.text = inputText
    }

}
